import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
import IndexView from '@/views/LayoutView.vue'
import Recommend from '@/views/Home/Index.vue'
import Video from '@/views/Home/Video.vue'
import MusicShop from "@/views/Home/MusicShop.vue"
import MusicRadar from "@/views/Home/MusicRadar.vue"
import MyLike from "@/views/Home/MyLike.vue"
import LocalAndDownload from "@/views/Home/LocalAndDownload.vue"
import RecentlyPlayed from "@/views/Home/RecentlyPlayed.vue"
import AuditionList from "@/views/Home/AuditionList.vue"
import Login from '@/views/Login/Index.vue'
import playListView from '@/views/Home/PlayListView.vue'
import SearchView from  "@/views/Search/SearchView.vue"

const router = createRouter({
  //history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'index',
      component: IndexView,
      redirect: 'recommand',
      meta: {
        keepAlive: false,
        online: false
      },
      children: [
        {
          path: "recommand",
          name: "recommand",
          component: Recommend,
          meta: {
            keepAlive: true,
            online: true
          }
        },
        {
          path: 'video',
          name: 'video',
          component: Video,
          meta: {
            keepAlive: true,
            online: true
          }
        },
        {
          path: 'musicShop',
          name: 'musicShop',
          component: MusicShop,
          meta: {
            keepAlive: true,
            online: true
          }
        },
        {
          path: 'musicRadar',
          name: 'musicRadar',
          component: MusicRadar,
          meta: {
            keepAlive: false,
            online: true
          }
        },
        {
          path: 'myLike/:play?',
          name: 'myLike',
          component: MyLike,
          meta: {
            keepAlive: false,
            online: false
          }
        },
        {
          path: 'localAndDownload/:play?',
          name: 'localAndDownload',
          component: LocalAndDownload,
          meta: {
            keepAlive: false,
            online: false
          }
        },
        {
          path: 'recentlyPlayed/:play?',
          name: 'recentlyPlayed',
          component: RecentlyPlayed,
          meta: {
            keepAlive: false,
            online: false
          }
        },
        {
          path: 'auditionList',
          name: 'auditionList',
          component: AuditionList,
          meta: {
            keepAlive: false,
            online: false
          }
        },
        {
          path: 'playlist/:id/:name',
          name: 'playlist',
          component: playListView,
          meta: {
            keepAlive: false,
            online: true
          }
        },
        {
          path: 'search/:action/:word?',
          name: 'search',
          component: SearchView,
          meta:{
            keepAlive: false,
            online: true
          }
        }
      ]
    },
    {
      path: '/login',
      name: '/login',
      component: Login,
      meta: {
        keepAlive: false,
        online: false
      }
    }
  ]
})

export default router
